/**
 * @param{object} cardData 卡片数据
 */
import React from 'react';
import { Icon } from 'antd-mobile';
import { history } from 'umi';
import PHONE from 'static/icon_phone.png';
import './index.less';

export default function SelfCard({ cardData }) {
  function handleClick() {
    history.push({
      pathname: '/storage/detail',
      query: { id: cardData.storingId },
    });
  }
  return (
    <div className="storage-selfCard" onClick={handleClick}>
      <div className="storage-selfCard-item">
        <span className="circle"></span>
        <span>{cardData.storehousePropertyText}</span>
        <span>-</span>
        <span>{cardData.storehouseTypeText}</span>
        <div className="storage-selfCard-item-icon">
          <img
            src={PHONE}
            className="phone"
            onClick={() => {
              window.location.href = 'tel://' + cardData.linkphone;
            }}
          />
          <Icon type="right" />
        </div>
      </div>
      <div className="storage-selfCard-item">
        <span className="circle"></span>
        <span>{cardData.city}</span>
      </div>
      <div className="storage-selfCard-tip">{cardData.leaseText}</div>
    </div>
  );
}
